home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2001 / MacHack 2001.toast / pc / The Hacks / Palm Finder 2 / Src / Panes / trashcan.cpp < prev    next >
Encoding:
Text File  |  2001-06-23  |  1023 b   |  70 lines

  1. // trashcan.cpp
  2.  
  3. // includes
  4. #include "trashcan.h"
  5. #include "Finder_res.h"
  6. #include "app_constants.h"
  7. #include "events.h"
  8.  
  9. // constants
  10. // static strings
  11. const char k_Trash[]= "Trash";
  12.  
  13. //
  14. // constructor
  15. //
  16. trashcan::trashcan(int x, int y, view* in_superview): 
  17.     icon(TrashCanBitmap, TrashCanMaskBitmap, k_Trash, x, y, in_superview)
  18. {
  19.     m_full = false;
  20. }
  21.  
  22. //
  23. // destructor
  24. //
  25. trashcan::~trashcan() {
  26. }
  27.  
  28. //
  29. // fill_up()
  30. //
  31. void                    
  32. trashcan::fill_up() { 
  33.     m_full = true; 
  34.     set_icon(FullTrashCanBitmap, FullTrashCanMaskBitmap, false);
  35. }
  36.  
  37. //
  38. // empty()
  39. //
  40. void                    
  41. trashcan::empty() { 
  42.     m_full = false; 
  43.     set_icon(TrashCanBitmap, TrashCanMaskBitmap, false);
  44. };
  45.  
  46.  
  47. //
  48. // do_cmd_self
  49. //
  50. Boolean    
  51. trashcan::do_cmd_self (int in_eventID, void* io_data) {
  52.     Boolean handled = false;
  53.  
  54.     switch (in_eventID) {
  55.         case cmd_empty_trash:
  56.             if (m_full) {
  57.                 empty();
  58.             } else {
  59.                 fill_up();
  60.             }
  61.             send_update_event();
  62.             handled = true;
  63.             break;
  64.         default:
  65.             icon::do_cmd_self (in_eventID, io_data);
  66.             break;
  67.     }
  68.     return handled;
  69. }
  70.